<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">

<title></title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    

<link rel="stylesheet" type="text/css" href="../css/edittable.css"  ></link>  
<link rel="stylesheet" type="text/css" href="../css/validate.css"  ></link>  
<script type="text/javascript"  src="../js/jquery-1.8.0.js"></script>

</head>
<body>
		 <form action="RoleServlet.do?flag=updateRole" method="post">
		 	<input type="hidden" value="${adminRoleInfo.id}" name="adminid">
			 <table class="edit_table" >
			 		<tr>
		 			 	<td class="td_info">用户名称:</td>	
		 			 	<td class="td_input_short"> 
		 			 		<label>${adminRoleInfo.adminName}</label>
		 			 	</td>
			 		</tr>
			 		<tr>
			 			<td class="td_info">角色:</td>
			 			<td>
			 				<select name="roleselect" id="roleselect">
			 					<option value="0">========请选择用户角色=======</option>
			 					<c:forEach var="role" items="${rolelist}">
			 						<option value="${role.roleName}">${role.roleName}</option>
			 					</c:forEach>
			 				</select>
			 			</td>	
			 		</tr>
			 		<tr>
			 			<td class="td_info"></td>
			 			<td> 
			 			<input class="form_btn" type="submit" value="提交"  onclick="return validate()"/> 
			 			<input type="reset"  class="form_btn" value="重置" /> </td>	
			 			<td>
			 				<label id="result_msg" class="result_msg">${msg}</label>
			 			</td>	
			 		</tr>
			</table>
     	</form>
     	
     	<script>
     		$(function(){
				var roleName = "${adminRoleInfo.roleName}"
					$("option").each(function(){
			   			if(this.value==roleName){
			   				this.selected=true;
			   			}	
			   		});
     		})
     	</script>
     	
     	<script>
     		function validate(){
     			if($("#roleselect").val()=="0"){
     				alert("请选择角色");
     				return false;
     			}else{
     				var l = confirm("确认授权吗")
	     			if(l){
	     				return true;
	     			}else{
	     				return false;
	     			}
     			}
     			
     		}
     	</script>
</body>
</html>